
import os
import string
import sys

response_name = "responsegooglesafebrowsing"

def ask_to_googlesafebrowsing(domain):
    request = "wget -q -Y  on 'http://www.google.com/safebrowsing/diagnostic?site="+domain+"' -O "+response_name
    
    #print request
    os.system(request)

#print sys.argv[1] #stampa di test
ask_to_googlesafebrowsing(sys.argv[1])
f = open(response_name)
while True:                 
    line = f.readline()
    #print line
    if not line: break
    if string.find(line,"Site is listed as suspicious - visiting this web site may harm your computer.") > 0:
        print "Site is listed as suspicious - visiting this web site may harm your computer." #stampa di test
    
    elif string.find(line,"This site is not currently listed as suspicious.") > 0:
        print "This site is not currently listed as suspicious." #stampa di test
    else:
        print line

os.remove(response_name)
